<?php $this->renderPartial('_tabs'); ?>
<div class="grid_16">
    <div class="admin-agency form">
        <div class="section">
			<div class="block">
				<?php
				$this->widget('PsGridView', array(
					'dataProvider' => $dataProvider,
					'columns' => array(
						'level',
						'user.name',
						array(
							'name' => 'interval',
							'value' => '$data->getIntervalAsString()'
						),
						'is_automatic',
						array(
							'class' => 'CButtonColumn',
							'template' => '{update}{delete}',
							'buttons' => array(
								'update' => array(
									'url' => 'array("modules/tickets/escalationLevelUpdate", "level" => $data->level)'
								),
								'delete' => array(
									'url' => 'array("modules/tickets/escalationLevelDelete", "level" => $data->level)',
									'click' => null,
								)
							)
						)
					)
				));
				?>
			</div>
        </div>
		<div class="section">
			<div class="block">
				<?php
				$form = $this->beginWidget('CActiveForm', array(
					'id' => 'admin-tickets-escalation-form',
					'enableAjaxValidation' => false,
					'htmlOptions' => array()
				));
				?>
				<strong>New Escalation Level</strong>
				<table class="table">
					<tr>
						<td>
							<div class="form-table-block">
								<?php echo $form->labelEx($newEscalationLevel, 'user_id', array('label' => 'User')); ?>
								<?php echo $form->dropDownList($newEscalationLevel, 'user_id', $this->getUserListData(), array('prompt' => 'Select user')); ?>
								<?php echo $form->error($newEscalationLevel, 'user_id'); ?>
							</div>
						</td>
						<td>
							<div class="form-table-block">
								<?php echo $form->labelEx($newEscalationLevel, 'interval'); ?>
								<?php echo $form->dropDownList($newEscalationLevel, 'interval', EscalationLevel::getIntervalsListData()); ?>
								<?php echo $form->error($newEscalationLevel, 'interval'); ?>
							</div>
						</td>
						<td>
							<div class="form-table-block">
								<?php echo $form->labelEx($newEscalationLevel, 'is_automatic'); ?>
								<?php echo $form->checkBox($newEscalationLevel, 'is_automatic'); ?>
								<?php echo $form->error($newEscalationLevel, 'is_automatic'); ?>
							</div>
						</td>
						<td>
							<div class="form-table-block">
								<label>C/C to:</label>
								<input id="email" type="text" style="width: 100%;" />
								<p class="hint">Separate each email with ';'</p>
							</div>
						</td>
					</tr>
				</table>
				<button type="submit" class="link-button green round_all no-margin">
					<span>Add Escalation Level</span>
				</button>
				<?php $this->endWidget(); ?>
			</div>
		</div>
    </div>
</div>